<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.mselect.css" rel="stylesheet" />
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.multiselect.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$(".parent").children().hide();
	$(".parent").addClass("pointer").toggle(
		function(){$(this).children().show();
		},function(){$(this).children().hide();}
	);
	$("select").multiselect({height: 260, minWidth: 160, selectedList: <?=count($shop_group, 1)?>});
	var product_categories_data = <?=$product_categories?>;
	$(document).mselect(product_categories_data, 'product_categories_id', 'product_categories_id', "<?=isset($_GET['product_categories_id']) ? $_GET['product_categories_id'] : 0?>");
	$(document).mselect(product_categories_data, 'move_cat_id', 'move_cat_id', 0);
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>发货日期</th>
	<td>
		<input type="text" name="begin_shipped_time" class="datepicker" value="<?=isset($_GET['begin_shipped_time']) ? $_GET['begin_shipped_time'] : ''?>" /> to
		<input type="text" name="end_shipped_time" class="datepicker" value="<?=isset($_GET['end_shipped_time']) ? $_GET['end_shipped_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>销售日期</th>
	<td>
		<input type="text" name="begin_sales_time" class="datepicker" value="<?=isset($_GET['begin_sales_time']) ? $_GET['begin_sales_time'] : ''?>" /> to
		<input type="text" name="end_sales_time" class="datepicker" value="<?=isset($_GET['end_sales_time']) ? $_GET['end_sales_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>分类</th>
	<td><input type="hidden" id="product_categories_id" name="product_categories_id" /></td>
</tr>
<tr>
	<th>网站</th>
	<td>
		<select name="shop_id[]" multiple="multiple">
		<?foreach ($shop_group as $k => $sg):?>
		<optgroup label="<?=$k?>">
		<?foreach ($sg as $s):?>
		<option value="<?=$s['id']?>" <?if (isset($_GET['shop_id']) && in_array($s['id'], $_GET['shop_id'])) echo "selected='selected'"?>><?=$s['name']?></option>
		<?endforeach;?>
		</optgroup>
		<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<th>产品编号</th>
	<td><input type="text" size="46" name="product_number" value="<?=isset($_GET['product_number']) ? $_GET['product_number'] : ''?>" />多个sku用英文逗号隔开(例：000001,000002 )</td>
</tr>
<tr>
	<td><input type="hidden" name="is_search" value="1" /></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<?if (! empty($product)):?>
<table class="list_table" width="50%">
<tr>
	<th>SKU</th>
	<th>产品名称</th>
	<th>销量</th>
</tr>
<?foreach ($product as $p):?>
<tr>
	<td>
		<?=$p['number']?>
		<?if ($p['pic_url']):?>
			<?$pretty_photo_number = 0;?>
			<?foreach ($p['pic_url'] as $pp):?>
			<a rel="pretty_photo[<?=$p['id']?>]" href="<?=$pp?>"><?if(!$pretty_photo_number):?><span class="img_icon"></span><?endif;?></a>
			<?$pretty_photo_number = 1;?>
			<?endforeach;?>
		<?endif;?>
	</td>
	<td><?=$p['name']?></td>
	<td><?=$p['quantity']?></td>
</tr>
<?endforeach;?>
</table>
<?endif;?>
<?php $this->_endblock();?>